#ifndef THRESHOLDMANAGE_H
#define THRESHOLDMANAGE_H

#include <QWidget>
#include <QDebug>
#include <QSqlTableModel>
#include "accessdb.h"

namespace Ui {
class ThresholdManage;
}

class ThresholdManage : public QWidget
{
    Q_OBJECT

public:
    explicit ThresholdManage(QWidget *parent = nullptr);
    ~ThresholdManage();

    void search();

    void revert();

    void submit();

    bool editable();

    bool editMode();

private:
    void init();

    void initTableView();

private slots:
    void on_btnEdit_clicked();

    void on_btnNew_clicked();

    void on_btnSubmit_clicked();

    void on_btnCancel_clicked();
    
    void on_btnDelete_clicked();

    void on_btnSearch_clicked();

private:
    Ui::ThresholdManage *ui;
    QSqlTableModel* m_sqlModel;
    bool m_editMode;
    QMap<int, int> m_hasChanged;
    AccessDB* m_access;
};

#endif // THRESHOLDMANAGE_H
